import Vue from 'vue'
import Spin from './Spin'
import Toast from './Toast'

import NoNetwork from './NoNetwork'
import Empty from './Empty'
import CartoEmpty from './CartoEmpty'
import Tab from './Tab'
import Spinner from './Spinner'
import Like from './Like'

const components = {
  'no-network': NoNetwork,
  'carto-empty': CartoEmpty,
  'empty': Empty,
  'tab': Tab,
  'tab-panel': Tab.panel,
  'like': Like,
  'spinner': Spinner
}

Vue.use({
  install: Vue => {
    Object.keys(components).forEach(key => {
      Vue.component(`w-${key}`, components[key])
    })

    Vue.prototype.$spin = window.$spin = Spin
    Vue.prototype.$toast = window.$toast = Toast
  }
})